
using Qdb.Activation;
using Qdb.TA;

namespace Qdb.Tests.Common.TA
{
	public class MockActivator : IActivator
	{
		private int _readCount;

		private int _writeCount;

		public MockActivator()
		{
		}

		public virtual int Count()
		{
			return _readCount + _writeCount;
		}

		public virtual void Activate(ActivationPurpose purpose)
		{
			if (purpose == ActivationPurpose.Read)
			{
				++_readCount;
			}
			else
			{
				++_writeCount;
			}
		}

		public virtual int WriteCount()
		{
			return _writeCount;
		}

		public virtual int ReadCount()
		{
			return _readCount;
		}

		public static Qdb.Tests.Common.TA.MockActivator ActivatorFor(IActivatable
			 obj)
		{
			Qdb.Tests.Common.TA.MockActivator activator = new Qdb.Tests.Common.TA.MockActivator
				();
			obj.Bind(activator);
			return activator;
		}
	}
}
